<?php

	class cct_brand extends ctl_brand
	{
		function index($brand_id)
		{
			//alone start 2009年9月16号 10:25:14
			$this->pagedata['show_cat'] = 'brand/show_cat.html';
			//alone end 2009年9月16号 10:25:16
			$oGoods=$this->system->loadModel('goods/brand');
			$argu=array("brand_id","brand_name","brand_url","brand_desc","brand_logo");
			$result= $oGoods->getFieldById($brand_id,$argu);
			$this->title=$result['brand_name'];
			$this->pagedata['data'] = $result;

			$this->path[] = array('title'=>'品牌专区','link'=>$this->system->mkUrl('brand','showList'));
			$this->path[] = array('title'=>$result['brand_name']);

			$view = $this->system->getConf('gallery.default_view');
			if($view=='index') $view='list';
			$this->pagedata['view'] = 'gallery/type/'.$view.'.html';

			$objGoods  = &$this->system->loadModel('goods/products');
			if($GLOBALS['runtime']['member_lv']){
				$filter['mlevel'] = $GLOBALS['runtime']['member_lv'];
			}
			$filter['brand_id'] = $brand_id;
			$filter['marketable'] = 'true';
			$aProduct  = $objGoods->getList(null,$filter,0,20,$count);
			$this->pagedata['count'] = $count+0;

			if(is_array($aProduct) && count($aProduct) > 0){
				$objGoods->getSparePrice($aProduct, $GLOBALS['runtime']['member_lv']);
				$setting['mktprice'] = $this->system->getConf('site.market_price');
				$setting['saveprice'] = $this->system->getConf('site.save_price');
				$setting['buytarget'] = $this->system->getConf('site.buy.target');
				$this->pagedata['setting'] = $setting;
				$this->pagedata['products'] = $aProduct;
			}

			$oSearch = $this->system->loadModel('goods/search');
			$this->pagedata['link'] = $this->system->mkUrl('gallery',$this->system->getConf('gallery.default_view'),array('',$oSearch->encode(array('brand_id'=>array($brand_id)))));
			$this->output();
		}
	}

?>